Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new aspect critic metrics #1286

Merged
merged 14 commits into from
Sep 13, 2024

Conversation

shahules786
Copy link
Member

@shahules786 shahules786 commented Sep 12, 2024

from ragas.dataset_schema import SingleTurnSample
from ragas.metrics._aspect_critic import AspectCritic


sample = SingleTurnSample(
    user_input="Where is the Eiffel Tower located?",
    response="The Eiffel Tower is located in Paris.",
    reference="The Eiffel Tower is located in Egypt"
)

scorer =  AspectCritic(name="harmlessness",definition="is the submission harmful")
scorer.llm = openai_model
await scorer.single_turn_ascore(sample)

shahules786 and others added 14 commits September 11, 2024 00:09
1. Add Non LLM based context precision
2. Rename and introduce naming convention to metrics -
<llm_or_non_llm><metric_name><with_or_without_reference>

```python

from ragas import SingleTurnSample
from ragas.metrics._context_precision import NonLLMContextPrecisionWithReference

context_precision = NonLLMContextPrecisionWithReference()

sample = SingleTurnSample(
    retrieved_contexts=["The Eiffel Tower is located in Paris."], 
    reference_contexts=["Paris is the capital of France.", "The Eiffel Tower is one of the most famous landmarks in Paris."]
)

await context_precision.single_turn_ascore(sample)
```

---------

Co-authored-by: Jithin James <jamesjithin97@gmail.com>
…1279)

Hello there 👋 I noticed that there was no way to disable the
progress bar and thought it'd nice to have the option to silence the
`tqdm` call in the executor, as it doesn’t play nicely with logs and
adds noise.

I've added the following changes:

Add `show_progress` flag to `Executor` class and update `evaluate`
function to use it.

* **Executor Class Changes:**
- Add `show_progress` flag to the `Executor` class in
`src/ragas/executor.py`.
- Use the `show_progress` flag to control the display of the progress
bar.
- If `show_progress` is set to False, disable `tqdm` usage for
displaying progress bars.

* **Evaluate Function Changes:**
- Add `show_progress` parameter to the `evaluate` function in
`src/ragas/evaluation.py`.
- Pass the `show_progress` flag to the `Executor` class during
initialization in the `evaluate` function.
@shahules786 shahules786 marked this pull request as ready for review September 12, 2024 13:27
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Sep 12, 2024
@shahules786
Copy link
Member Author

Apologies for the mess in commit section, this branch was cut not from main.

@shahules786 shahules786 changed the title feat: New aspect_critic feat: new aspect critic metrics Sep 12, 2024
@jjmachan jjmachan merged commit 6687cb5 into explodinggradients:main Sep 13, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants